package com.sskj.b70.p.activity;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.sskj.b70.m.HttpConfig;
import com.sskj.b70.m.bean.HttpData;
import com.sskj.b70.m.bean.XiTongBean;
import com.sskj.b70.m.http.JsonCallBack;
import com.sskj.b70.p.base.BasePresenter;
import com.sskj.b70.utils.ToastUtil;
import com.sskj.b70.v.activity.AboutUsActivity;

import java.util.List;

/**
 * <pre>
 *     author : wk_math
 *     e-mail : wk_math@163.com
 *     time   : 2018/03/30
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class AboutUsPresenter extends BasePresenter<AboutUsActivity> {

    public void getEmail() {
        httpService.aboutMine()
                .execute(new JsonCallBack<HttpData<List<XiTongBean>>>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData<List<XiTongBean>>> response) {
                        HttpData<List<XiTongBean>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.STATUS_OK) {
                            mView.dialogEmail(httpData.getData().get(0).email);
                        } else {
                            ToastUtil.showShort(httpData.getMsg());
                        }
                    }
                });

    }
}
